{{ $title := .Title | markdownify }}
{{ $date := .Date | dateFormat "January 2, 2006" }}
{{ $badges := .Params.badges }}
{{ $colors := dict "deprecation" "red" "enhancement" "green" "new feature" "blue"
  "breaking change" "yellow" "featured" "violet" "performance" "orange"
  "announcement" "fuchsia"
}}
{{ $type := $badges.type | default "enhancement" }}
{{ $color := index $colors $type }}


<div>
  <a href="{{ .RelPermalink }}">
    <div
      class="border-t-6 border-{{ $color }}-500 bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-900 rounded-md shadow"
    >
      <div class="flex flex-col justify-between p-6">
        <span class="text-lg leading-tight font-semibold tracking-tight text-dark dark:text-gray-300">
          {{ $title }}
        </span>

        <p class="mt-3 mb-4 text-sm text-dark dark:text-gray-200 font-light">
          <time datetime="{{ $date }}">
            {{ $date }}
          </time>
        </p>

        {{ partial  "author-with-avatar.html" . }}


        <div class="block space-y-1.5 mt-1.5">
          {{ with $badges.type }}
            {{ $color := cond (eq . "deprecation") "red" "blue" }}
            {{ partial "badge.html" (dict "prefix" "type" "word" . "color" $color "inline" true) }}
          {{ end }}

          {{ range $badges.domains }}
            {{ partial "badge.html" (dict "prefix" "domain" "word" . "color" "indigo" "inline" true) }}
          {{ end }}

          {{ range $badges.sources }}
            {{ partial "badge.html" (dict "prefix" "source" "word" . "color" "violet" "inline" true) }}
          {{ end }}

          {{ range $badges.transforms }}
            {{ partial "badge.html" (dict "prefix" "transform" "word" . "color" "violet" "inline" true) }}
          {{ end }}

          {{ range $badges.sinks }}
            {{ partial "badge.html" (dict "prefix" "sink" "word" . "color" "violet" "inline" true) }}
          {{ end }}
        </div>
      </div>
    </div>
  </a>
</div>
